package com.cpdmali.courrier.serveur.processor;

import java.util.List;

import org.apache.thrift.TException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.stereotype.Component;

import com.cpdmal.courrier.service.thrift.Cpdmalimail;
import com.cpdmal.courrier.service.thrift.Domains;
import com.cpdmal.courrier.service.thrift.Forwarding;
import com.cpdmal.courrier.service.thrift.Users;
import com.cpdmali.courrier.manager.ServiceManager;

@Component
public class CpdMaliCourrierHandler implements Cpdmalimail.Iface{
	
	private static final Logger log = LoggerFactory.getLogger(CpdMaliCourrierHandler.class);
		
	@Override
	public void addUsers(Users usersStruct) throws TException {
		log.info("Debut service add users :"+usersStruct.toString());
		System.out.println("add Users");
		com.cpdmali.courrier.entities.Domains domains = new com.cpdmali.courrier.entities.Domains();
		
		domains.setDomain("test.com");
		try {
			ServiceManager.getInstance().getDomainsService().persist(domains);
		} catch (Exception e) {
			log.debug("domain.persist : ", e);
		}
		log.info("Fin service add users ");
	}

	@Override
	public Users getUsers(String email) throws TException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Users> getAllUsers() throws TException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void addListUsers(List<Users> listUsers) throws TException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void addDomain(Domains domain) throws TException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public Domains getDomain(String domain) throws TException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Domains> getAllDomains() throws TException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void addForwarding(Forwarding forwarding) throws TException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public List<Forwarding> getAllForwarding() throws TException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Forwarding> getForwardingBySource(String source)
			throws TException {
		// TODO Auto-generated method stub
		return null;
	}

}
